import {mSelectItemByCode} from '@/api/public'
import {message} from '@/libs/global/antDesignVue'

const InterfaceDocument = defineComponent({
  setup(props, ctx) {
    const apiPostDocumentUrl = ref(
      'https://console-docs.apipost.cn/preview/ab809939392d47ed/cca249d336758090?target_id=8efccfb7-5e18-4d34-beeb-f1dbeac9a700'
    )

    onMounted(() => {
      mSelectItemByCode({
        code: '0215'
      })
        .then(res => {
          apiPostDocumentUrl.value = res.data.dictValue
        })
        .catch(err => {
          message.error('恒蓝云接口文档地址获取失败')
        })
    })
    return () => (
      <iframe
        class='w-full h-900 rounded-4'
        style={{
          height: 'calc(100% - 34px)'
        }}
        src={apiPostDocumentUrl.value}
      ></iframe>
    )
  }
})

export default InterfaceDocument
